/*
 * Digital Audio Mobile - A multi track studio for Windows Mobile
 * Copyright (C) 2008 David Olsson
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#if !defined(__DAMDIALOG_H__)
#define __DAMDIALOG_H__

#include "ClickGenerator.h"
#include "Dialog.h"
#include "InputDevice.h"
#include "OutputDevice.h"

class AudioBuffer;
class Composition;
class CompositionInfoControl;
class Track;
class TrackInfoControl;
class TrackRollControl;

class DamDialog: public Dialog, private Device::BufferHandler {
public:
    DamDialog(HINSTANCE hInstance, InputDevice *inDevice, OutputDevice *outDevice) throw();
    virtual ~DamDialog();

    void setCurrentTrack(Track *currTrack) throw();

    void togglePlay() throw();
private:
    virtual bool close(CloseCommand cc) throw();
    virtual void controlNotification(HWND hWnd, WPARAM notification) throw();
    virtual void menuNotification(unsigned int itemId) throw();

    virtual void started(Device *device) throw();
    virtual void stopped(Device *device) throw();
    virtual void bufferCompleted(Device *device, const AudioBuffer *buffer) throw();

    ClickGenerator m_clickGen;

    InputDevice *m_inDevice;
    OutputDevice *m_outDevice;
    AudioBuffer *m_outBuffer1, *m_outBuffer2;

    CompositionInfoControl *m_compositionInfo;
    TrackInfoControl *m_trackInfo;
    TrackRollControl *m_trackRoll;

    Composition *m_composition;

    static const unsigned int BUFFERSIZE;
    static const unsigned int ID_SETTINGS;
    static const unsigned int ID_ABOUT;
};

#endif
